Skip to content

Refactor RAG from agent-level config to standard toolset type#2210

Draft
dgageot wants to merge 4 commits intodocker:mainfrom
dgageot:rag-toolset
Draft

Refactor RAG from agent-level config to standard toolset type#2210
dgageot wants to merge 4 commits intodocker:mainfrom
dgageot:rag-toolset

Conversation

@dgageot
Copy link
Member

@dgageot dgageot commented Mar 21, 2026

Replace the special-cased RAG configuration (AgentConfig.RAG []string referencing top-level Config.RAG map) with a standard toolset type (type: rag) that follows the same patterns as MCP and other toolsets.

Key changes:

  • Add 'type: rag' to toolset registry with ref support for shared definitions
  • Introduce RAGToolset wrapper (mirrors MCPToolset) for top-level rag section
  • Add RAGConfig field to Toolset for inline/resolved RAG configuration
  • Add resolveRAGDefinitions() mirroring resolveMCPDefinitions()
  • Extract rag.NewManager() for per-toolset manager creation
  • Implement tools.Startable on RAGTool for lazy init and file watching
  • Remove RAG special-casing from Team, LocalRuntime, and teamloader
  • Add v6→v7 migration for old rag agent field to toolset entries
  • Update schema, docs, and all example YAML files

Assisted-By: docker-agent

@dgageot dgageot marked this pull request as ready for review March 22, 2026 11:30
@dgageot dgageot requested a review from a team as a code owner March 22, 2026 11:31
docker-agent[bot]

This comment was marked as outdated.

@dgageot dgageot marked this pull request as draft March 23, 2026 08:12
dgageot added 4 commits March 23, 2026 22:17
Replace the special-cased RAG configuration (AgentConfig.RAG []string referencing
top-level Config.RAG map) with a standard toolset type (type: rag) that follows
the same patterns as MCP and other toolsets.

Key changes:
- Add 'type: rag' to toolset registry with ref support for shared definitions
- Introduce RAGToolset wrapper (mirrors MCPToolset) for top-level rag section
- Add RAGConfig field to Toolset for inline/resolved RAG configuration
- Add resolveRAGDefinitions() mirroring resolveMCPDefinitions()
- Extract rag.NewManager() for per-toolset manager creation
- Implement tools.Startable on RAGTool for lazy init and file watching
- Remove RAG special-casing from Team, LocalRuntime, and teamloader
- Add v6→v7 migration for old rag agent field to toolset entries
- Update schema, docs, and all example YAML files

Assisted-By: docker-agent
The PR docker#2210 moved RAG from agent-level config to standard toolset type
(tools.Startable) but removed the event forwarding that showed indexing
progress in the TUI sidebar.

This restores event forwarding by:
- Adding an EventCallback to RAGTool that forwards rag.Manager events
  during Start() initialization
- Having StartBackgroundRAGInit discover RAG tools from agent toolsets
  and wire up the event callback before initialization happens
- Converting RAG manager events (indexing started/progress/completed,
  usage, errors) back to runtime events for the TUI

Assisted-By: docker-agent
Signed-off-by: David Gageot <david.gageot@docker.com>
- Remove RAGInitializer interface and StartBackgroundRAGInit indirection.
  RAG event callbacks are now wired in configureToolsetHandlers alongside
  other handler setup, using the same pattern as Elicitable/OAuthCapable.

- Remove deprecated NewManagers wrapper (no callers after toolset refactor).

- Clean up RAGTool: unexport internal types (QueryRAGArgs, QueryResult),
  inline sortResults, remove verbose debug logging from Tools(), simplify
  handleQueryRAG.

Assisted-By: docker-agent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants